$(function() {
	initComminity();
});

function audit(id) {
	var checkUrl = "/IMS/proEverify/audit.ht";
	var web_token = $("input[name='web_token']").val();

	checkUrl = checkUrl + "?checkId=" + id + "&web_token=" + web_token;
	$.ajax({
		url : checkUrl,
		beforeSend : function() {
			showProccessBar()
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data) {
			_alert(data.message, function() {
				var url = "/IMS/proEverify/showList.ht";
				url = url + "?search=" + $('#search').val();
				$.go(url, {
					dataType : 'html',
					error : function() {
						hideProccessBar();
					},
					success : function(data, textStatus) {
						replaceDocument(url, data);
					}
				}, true);
			});
		}
	});
}

function initComminity() {
	var obj = 'communityId';
	var communityUrl = "/IMS/select/getCommunityList.ht";
	initCommunityWidget(obj, communityUrl, true);
}

function isPass(id) {
	_confirm("<span style='color:#FE6600'>是否确认审核通过？</span>", function() {
		var checkUrl = "/IMS/proEverify/proVerify.ht";
		var web_token = $("input[name='web_token']").val() || '';
		checkUrl = checkUrl + "?checkId=" + id + "&status=0&web_token=" + web_token;
		$.ajax({
			url : checkUrl,
			beforeSend : function() {
				showProccessBar()
			},
			error : function() {
				hideProccessBar();
			},
			success : function(data) {
				_alert(data.message, function() {
					var url = "/IMS/proEverify/showList.ht";
					url = url + "?search=" + $('#search').val();
					$.go(url, {
						dataType : 'html',
						error : function() {
							hideProccessBar();
						},
						success : function(data, textStatus) {
							replaceDocument(url, data);
						}
					});
				}, true);
			}
		});
	});

}

function isNotPass(id) {
	_confirm("<span style='color:#FE6600'>是否确认审核不通过？</span>", function() {
		var checkUrl = "/IMS/proEverify/proVerify.ht";
		var web_token = $("input[name='web_token']").val();
		checkUrl = checkUrl + "?checkId=" + id + "&status=&web_token=" + web_token;
		$.ajax({
			url : checkUrl,
			beforeSend : function() {
				showProccessBar()
			},
			error : function() {
				hideProccessBar();
			},
			success : function(data) {
				_alert(data.message, function() {
					var url = "/IMS/proEverify/showList.ht";
					url = url + "?search=" + $('#search').val();
					$.go(url, {
						dataType : 'html',
						error : function() {
							hideProccessBar();
						},
						success : function(data, textStatus) {
							replaceDocument(url, data);
						}
					});
				}, true);
			}
		});

	});
}

function searchSubmit() {
	if (userType == '3') {
		/*
		var search = $("#search").val();
		if (Is_Null(search)) {
			_alert("请输入查询条件后再进行搜索");
			return;
		}
		*/
	} else {
		/*
		var coummunityId = $("#select2-communityId-container").text();
		if (coummunityId == '请选择小区') {
			_alert("请选择小区");
			return;
		}
		*/
	}
	$.submit($('#frm'), {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar()
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			var url = $('#frm').attr('action');
			replaceDocument(url, data);
		}
	});
}